import essenceClasses.User;
import helper.TaskHelper;
import helper.UserHelper;
import model.CurrentTaskModel;
import model.TaskModel;
import model.TaskState;
import model.UserModel;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * Created with IntelliJ IDEA.
 * User: Алексей
 * Date: 31.05.14
 * Time: 21:25
 * To change this template use File | Settings | File Templates.
 */
public class TestClass {

    public static void main(String[] args) {
        UserModel um = new UserModel();
        TaskModel tm = new TaskModel();
        CurrentTaskModel cm = new CurrentTaskModel();
        UserHelper userHelper = new UserHelper();
        TaskHelper taskHelper = new TaskHelper();

        SimpleDateFormat textFormat = new SimpleDateFormat("yyyy-MM-dd");
        String input = "2007-12-25";
        java.sql.Date  myDate = null;

        try {
            myDate = (java.sql.Date) textFormat.parse(input);

        } catch (ParseException e) {
            e.printStackTrace();
        }


        try {
            System.out.println(
                    "1. Проверка на добавления юзера : "
                    + userHelper.AddUser("Vasya", "123", "galimarovich", 1)
                    + userHelper.AddUser("petro", "qwe", "moiseevich", 1)
                    + userHelper.AddUser("zhuzha", "sdddf", "moyshovich", 1)) ;





        } catch (Exception e) {
            e.printStackTrace();
        }

        try {

            System.out.println("5. Проверка на поиск всех tasks: " + taskHelper.addTask("", "", 2, myDate, myDate, myDate));
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            System.out.println("2. Проверка на залогинивание : " + userHelper.Login("LOGIN", "Pass"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            System.out.println("3. Проверка на поиск пользователя: " + userHelper.getTheUser("Vasya"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            System.out.println("4. Проверка на поиск всех пользователей: " + userHelper.getAllUser());
        } catch (Exception e) {
            e.printStackTrace();
        }
       try {
           System.out.println("1a. Проверка на поиск всех tasks: " + taskHelper.getAllTask(1));
       } catch (Exception e) {
           e.printStackTrace();
       }
       try {
           System.out.println("2a. Проверка на поиск всех tasks: " + taskHelper.getCurrentTaskByTaskId(1));
       } catch (Exception e) {
           e.printStackTrace();
       }
       try {
           System.out.println("3a. Проверка на поиск всех tasks: " + taskHelper.getCurrentTaskByRecepientId(2));
       } catch (Exception e) {
           e.printStackTrace();
       }
       try {
           System.out.println("4a. Проверка на поиск всех tasks: " + taskHelper.getCurrentTaskByState(TaskState.INWORK));
       } catch (Exception e) {
           e.printStackTrace();
       }



    }
}
